

<!DOCTYPE html>
<html lang="zh-CN" data-default-color-scheme=auto>



<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/img/favicon.png">
  <link rel="icon" href="/img/favicon.png">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="author" content="MiaoHao-oops">
  <meta name="keywords" content="">
  
    <meta name="description" content="这篇文章介绍了 FUSE 的基本原理，并对其进行了性能测试与分析。">
<meta property="og:type" content="article">
<meta property="og:title" content="文献阅读: To FUSE or Not to FUSE: Performance of User-Space File Systems">
<meta property="og:url" content="http://miaohao-oops.github.io/2024/03/10/%E6%96%87%E7%8C%AE%E9%98%85%E8%AF%BB-To-FUSE-or-Not-to-FUSE-Performance-of-User-Space-File-Systems/index.html">
<meta property="og:site_name" content="Miao&#39;s Blog">
<meta property="og:description" content="这篇文章介绍了 FUSE 的基本原理，并对其进行了性能测试与分析。">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="http://miaohao-oops.github.io/img/FUSE-high-level-architecture.png">
<meta property="og:image" content="http://miaohao-oops.github.io/img/FUSE-request-types.png">
<meta property="og:image" content="http://miaohao-oops.github.io/img/FUSE-queues.png">
<meta property="article:published_time" content="2024-03-10T08:12:44.000Z">
<meta property="article:modified_time" content="2024-03-14T07:58:24.189Z">
<meta property="article:author" content="MiaoHao-oops">
<meta property="article:tag" content="paper">
<meta property="article:tag" content="fuse">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="http://miaohao-oops.github.io/img/FUSE-high-level-architecture.png">
  
  
  <title>文献阅读: To FUSE or Not to FUSE: Performance of User-Space File Systems - Miao&#39;s Blog</title>

  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4/dist/css/bootstrap.min.css" />


  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/github-markdown-css@4/github-markdown.min.css" />
  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/hint.css@2/hint.min.css" />

  
    
    
      
      <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/highlight.js@10/styles/github-gist.min.css" />
    
  

  
    <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3/dist/jquery.fancybox.min.css" />
  


<!-- 主题依赖的图标库，不要自行修改 -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_ba1fz6golrf.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_lbnruvf0jn.css">


<link  rel="stylesheet" href="/css/main.css" />

<!-- 自定义样式保持在最底部 -->


  <script id="fluid-configs">
    var Fluid = window.Fluid || {};
    var CONFIG = {"hostname":"miaohao-oops.github.io","root":"/","version":"1.8.14","typing":{"enable":true,"typeSpeed":70,"cursorChar":"_","loop":false},"anchorjs":{"enable":true,"element":"h1,h2,h3,h4,h5,h6","placement":"right","visible":"hover","icon":""},"progressbar":{"enable":true,"height_px":3,"color":"#29d","options":{"showSpinner":false,"trickleSpeed":100}},"copy_btn":true,"image_zoom":{"enable":true,"img_url_replace":["",""]},"toc":{"enable":true,"headingSelector":"h1,h2,h3,h4,h5,h6","collapseDepth":0},"lazyload":{"enable":true,"loading_img":"/img/loading.gif","onlypost":false,"offset_factor":2},"web_analytics":{"enable":true,"baidu":null,"google":null,"gtag":null,"tencent":{"sid":null,"cid":null},"woyaola":null,"cnzz":null,"leancloud":{"appId":"y7tlaLEOoW5C1xBYm8VBo64Q-gzGzoHsz","appKey":"F7gylUefEEtQk24FEbvgfnBi","server_url":"https://y7tlaleo.lc-cn-n1-shared.com","path":"window.location.pathname","ignore_local":true}},"search_path":"/local-search.xml"};
  </script>
  <script  src="/js/utils.js" ></script>
  <script  src="/js/color-schema.js" ></script>
<meta name="generator" content="Hexo 6.0.0"><link rel="alternate" href="/atom.xml" title="Miao's Blog" type="application/atom+xml">
</head>


<body>
  <header style="height: 70vh;">
    <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand" href="/">
      <strong>MiaoHao-oops</strong>
    </a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/">
                <i class="iconfont icon-home-fill"></i>
                首页
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/archives/">
                <i class="iconfont icon-archive-fill"></i>
                归档
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/categories/">
                <i class="iconfont icon-category-fill"></i>
                分类
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/tags/">
                <i class="iconfont icon-tags-fill"></i>
                标签
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/about/">
                <i class="iconfont icon-user-fill"></i>
                关于
              </a>
            </li>
          
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" target="_self" href="javascript:;" data-toggle="modal" data-target="#modalSearch" aria-label="Search">
              &nbsp;<i class="iconfont icon-search"></i>&nbsp;
            </a>
          </li>
        
        
          <li class="nav-item" id="color-toggle-btn">
            <a class="nav-link" target="_self" href="javascript:;" aria-label="Color Toggle">&nbsp;<i
                class="iconfont icon-dark" id="color-toggle-icon"></i>&nbsp;</a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

    <div class="banner" id="banner" parallax=true
         style="background: url('/img/default.png') no-repeat center center;
           background-size: cover;">
      <div class="full-bg-img">
        <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
          <div class="page-header text-center fade-in-up">
            <span class="h2" id="subtitle" title="文献阅读: To FUSE or Not to FUSE: Performance of User-Space File Systems">
              
            </span>

            
              <div class="mt-3">
  
  
    <span class="post-meta">
      <i class="iconfont icon-date-fill" aria-hidden="true"></i>
      <time datetime="2024-03-10 16:12" pubdate>
        2024年3月10日 下午
      </time>
    </span>
  
</div>

<div class="mt-1">
  
    <span class="post-meta mr-2">
      <i class="iconfont icon-chart"></i>
      5.5k 字
    </span>
  

  
    <span class="post-meta mr-2">
      <i class="iconfont icon-clock-fill"></i>
      
      
      46 分钟
    </span>
  

  
  
    
      <!-- LeanCloud 统计文章PV -->
      <span id="leancloud-page-views-container" class="post-meta" style="display: none">
        <i class="iconfont icon-eye" aria-hidden="true"></i>
        <span id="leancloud-page-views"></span> 次
      </span>
    
  
</div>

            
          </div>

          
        </div>
      </div>
    </div>
  </header>

  <main>
    
      

<div class="container-fluid nopadding-x">
  <div class="row nomargin-x">
    <div class="d-none d-lg-block col-lg-2"></div>
    <div class="col-lg-8 nopadding-x-md">
      <div class="container nopadding-x-md" id="board-ctn">
        <div class="py-5" id="board">
          <article class="post-content mx-auto">
            <!-- SEO header -->
            <h1 style="display: none">文献阅读: To FUSE or Not to FUSE: Performance of User-Space File Systems</h1>
            
            <div class="markdown-body">
              <h1
id="to-fuse-or-not-to-fuse-performance-of-user-space-file-systems">To
FUSE or Not to FUSE: Performance of User-Space File Systems</h1>
<blockquote>
<p>论文作者：Bharath Kumar Reddy Vangoor, Stony Brook University; Vasily
Tarasov, IBM Research-Almaden; Erez Zadok, Stony Brook University</p>
<p>发表会议：FAST'17: Proceedings of the 15th Usenix Conference on File
and Storage Technologies</p>
<p>发表时间：February 2017</p>
</blockquote>
<p>FUSE，即 Filesystem in
USErspace，用户空间的文件系统。对于传统的宏内核而言，文件系统都实现在内核态，而
FUSE
这项技术使得可以在用户空间实现文件系统。用户空间文件系统通常用于进行原型验证，这是因为它具有开发便捷的特点。然而，在用户空间实现文件系统却带来了巨大的性能开销，因此
FUSE 颇具争议：FUSE 能否用于开发生产环境下的文件系统。本文对 FUSE
进行了性能追踪和统计，并在真实负载下分析了 FUSE 的性能瓶颈。</p>
<h2 id="fuse-design">FUSE design</h2>
<h3 id="high-level-architecture">High-Level Architecture</h3>
<p>从高层视角来看 FUSE，一个 FUSE 文件系统包含两个部分：</p>
<ul>
<li>内核态 FUSE driver，它对用户态暴露
<code>/dev/fuse</code>，用于用户态 FUSE deamon 和
内核通信，并负责管理和分发来自应用程序的 request</li>
<li>用户态 FUSE library，用户态的 FUSE deamon 基于 FUSE library
编写，实际上，这个库对 FUSE 操作进行了更高层的封装，使得基于 FUSE
构建文件系统更加容易</li>
</ul>
<p><img src="/img/FUSE-high-level-architecture.png" srcset="/img/loading.gif" lazyload /></p>
<p>FUSE 的简化工作流程如下：</p>
<ol type="1">
<li>用户空间 Application 发起对 FUSE 文件系统的文件操作</li>
<li>内核态 VFS 将操作请求路由到 FUSE 驱动程序</li>
<li>根据请求类型，创建 FUSE request，并挂载到队列中</li>
<li><code>/dev/fuse</code> 分发 request 给用户态的 FUSE deamon</li>
<li>FUSE deamon 根据收到的 request 执行对应的处理</li>
<li>处理结束后，FUSE deamon 通过 <code>/dev/fuse</code> 发送 reply
告知内核</li>
<li>FUSE driver 将请求项从队列删除，将操作结果返回给用户程序</li>
</ol>
<h3 id="implementation-details">Implementation Details</h3>
<h4 id="user-kernel-protocol">User-Kernel Protocol</h4>
<p><img src="/img/FUSE-request-types.png" srcset="/img/loading.gif" lazyload /></p>
<p>上表总结了 FUSE 的 43 种 request，其中加黑的与 VFS
操作语意有些出入。</p>
<ul>
<li><strong>INIT</strong>：当文件系统被挂载时由内核产生。用户和内核确认
<ol type="1">
<li>协议版本</li>
<li>相互支持的能力集合（如 READDIRPLUS 的支持）</li>
<li>各种参数的设置（如 FUSE 预读大小、时间粒度）</li>
</ol></li>
<li><strong>DESTROY</strong>：当文件系统被卸载时由内核产生。FUSE deamon
执行清理工作，任何与该文件系统 request
都无法被送往用户空间处理，而后，FUSE deamon 将退出</li>
<li><strong>INTERRUPT</strong>：由内核发出，用于停止某个
request（如一个等待 READ 的进程终止了）。</li>
</ul>
<blockquote>
<p><em>sequence#</em>：每一个 request 都有一个唯一的 <em>sequence#</em>
用于识别，该序列号由内核分配</p>
<p><em>node ID</em>：一个 64 位的无符号整数，用于在内核和用户空间识别
inode</p>
</blockquote>
<ul>
<li><strong>LOOKUP</strong>：进行 path-to-inode 转换，每次 lookup 一个
inode 时，内核就将其放入 inode 缓存</li>
<li><strong>FORGET</strong> &amp; <strong>BATCH_FORGET</strong>：将
inode 从缓存中删除，并通知 FUSE deamon 释放相关数据结构</li>
<li><strong>OPEN</strong>：打开文件，FUSE deamon 可以选择性地返回一个 64
位的文件句柄，而后每一个与该文件有关的 request 都将带有这个句柄</li>
</ul>
<blockquote>
<p><em>file handle</em>：FUSE deamon
可以利用该句柄存储打开文件的信息，例如在栈文件系统中，FUSE
文件系统可以将底层文件系统的描述符存储为 FUSE 文件句柄的一部分</p>
</blockquote>
<ul>
<li><strong>FLUSH</strong>：关闭文件</li>
<li><strong>RELEASE</strong>：之前打开的文件没有任何引用时发出</li>
<li><strong>OPENDIR</strong> &amp; <strong>RELEASEDIR</strong>：与
<strong>OPEN</strong> 和 <strong>RELEASE</strong>
语义相同，但操作对象是目录文件</li>
<li><strong>READDIR</strong> &amp;
<strong>READDIRPLUS</strong>：返回目录项，<strong>READDIRPLUS</strong>
还会返回每个项的元数据信息</li>
<li><strong>ACCESS</strong>：内核用于确认用户进程对于某个文件是否具有访问权限</li>
</ul>
<h4 id="library-and-api-levels">Library and API Levels</h4>
<p>在用户空间 FUSE 的 API 严格来说有两层，底层 API 负责实现与内核 FUSE
driver 的基本通信，基于底层 API 所构建的高层 API
用于方便用户态文件系统的编写。</p>
<blockquote>
<p>底层 API vs. 高层 API <span class="math inline">\(\approx\)</span>
flexibility vs. development ease</p>
</blockquote>
<p><strong>底层 API</strong>：</p>
<ol type="1">
<li>接收并翻译来自内核的 request</li>
<li>发送格式化的 reply</li>
<li>为文件系统的配置和挂载提供便利</li>
<li>为内核和用户空间隐藏可能的版本差异</li>
</ol>
<p><strong>高层 API</strong> 包含更多语义，尤其是隐藏了
<em>path-to-inode</em> map 的细节，从而高层 API
中都是<strong>直接操作文件路径</strong>的方法。</p>
<h4 id="queues">Queues</h4>
<p>FUSE 的队列存在于内核态，由 request 构成。FUSE driver 通过管理
request 队列进行 request 调度。FUSE 中包含 5
个不同的队列，分别用于管理不同种类的 request，同时，不同队列中的 request
具有不同的优先级，当 FUSE driver 决定发送哪个 request 给 FUSE deamon
时，优先级就会起到作用。</p>
<p><img src="/img/FUSE-queues.png" srcset="/img/loading.gif" lazyload /></p>
<p>FUSE 中的 5 个队列名称及其对应功能：</p>
<table>
<thead>
<tr class="header">
<th style="text-align: center;">名称</th>
<th style="text-align: center;">功能</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: center;"><em>interrupts</em></td>
<td style="text-align: center;">INTERRUPT request</td>
</tr>
<tr class="even">
<td style="text-align: center;"><em>forgets</em></td>
<td style="text-align: center;">FORGET request</td>
</tr>
<tr class="odd">
<td style="text-align: center;"><em>pending</em></td>
<td style="text-align: center;">同步 request</td>
</tr>
<tr class="even">
<td style="text-align: center;"><em>processing</em></td>
<td style="text-align: center;">正在处理的 request</td>
</tr>
<tr class="odd">
<td style="text-align: center;"><em>background</em></td>
<td style="text-align: center;">异步 request</td>
</tr>
</tbody>
</table>
<h2 id="fuse-workflow">FUSE Workflow</h2>
<p>Linux FUSE
文档<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup>中给出了一个
FUSE 的工作流程：</p>
<figure class="highlight gherkin"><table><tr><td class="gutter"><div class="code-wrapper"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br></pre></div></td><td class="code"><pre><code class="hljs gherkin">|<span class="hljs-string">  &quot;rm /mnt/fuse/file&quot;               </span>|<span class="hljs-string">  FUSE filesystem daemon</span><br><span class="hljs-string"></span>|<span class="hljs-string">                                    </span>|<br>|<span class="hljs-string">                                    </span>|<span class="hljs-string">  &gt;sys_read()</span><br><span class="hljs-string"></span>|<span class="hljs-string">                                    </span>|<span class="hljs-string">    &gt;fuse_dev_read()</span><br><span class="hljs-string"></span>|<span class="hljs-string">                                    </span>|<span class="hljs-string">      &gt;request_wait()</span><br><span class="hljs-string"></span>|<span class="hljs-string">                                    </span>|<span class="hljs-string">        [sleep on fc-&gt;waitq]</span><br><span class="hljs-string"></span>|<span class="hljs-string">                                    </span>|<br>|<span class="hljs-string">  &gt;sys_unlink()                     </span>|<br>|<span class="hljs-string">    &gt;fuse_unlink()                  </span>|<br>|<span class="hljs-string">      [get request from             </span>|<br>|<span class="hljs-string">       fc-&gt;unused_list]             </span>|<br>|<span class="hljs-string">      &gt;request_send()               </span>|<br>|<span class="hljs-string">        [queue req on fc-&gt;pending]  </span>|<br>|<span class="hljs-string">        [wake up fc-&gt;waitq]         </span>|<span class="hljs-string">        [woken up]</span><br><span class="hljs-string"></span>|<span class="hljs-string">        &gt;request_wait_answer()      </span>|<br>|<span class="hljs-string">          [sleep on req-&gt;waitq]     </span>|<br>|<span class="hljs-string">                                    </span>|<span class="hljs-string">      &lt;request_wait()</span><br><span class="hljs-string"></span>|<span class="hljs-string">                                    </span>|<span class="hljs-string">      [remove req from fc-&gt;pending]</span><br><span class="hljs-string"></span>|<span class="hljs-string">                                    </span>|<span class="hljs-string">      [copy req to read buffer]</span><br><span class="hljs-string"></span>|<span class="hljs-string">                                    </span>|<span class="hljs-string">      [add req to fc-&gt;processing]</span><br><span class="hljs-string"></span>|<span class="hljs-string">                                    </span>|<span class="hljs-string">    &lt;fuse_dev_read()</span><br><span class="hljs-string"></span>|<span class="hljs-string">                                    </span>|<span class="hljs-string">  &lt;sys_read()</span><br><span class="hljs-string"></span>|<span class="hljs-string">                                    </span>|<br>|<span class="hljs-string">                                    </span>|<span class="hljs-string">  [perform unlink]</span><br><span class="hljs-string"></span>|<span class="hljs-string">                                    </span>|<br>|<span class="hljs-string">                                    </span>|<span class="hljs-string">  &gt;sys_write()</span><br><span class="hljs-string"></span>|<span class="hljs-string">                                    </span>|<span class="hljs-string">    &gt;fuse_dev_write()</span><br><span class="hljs-string"></span>|<span class="hljs-string">                                    </span>|<span class="hljs-string">      [look up req in fc-&gt;processing]</span><br><span class="hljs-string"></span>|<span class="hljs-string">                                    </span>|<span class="hljs-string">      [remove from fc-&gt;processing]</span><br><span class="hljs-string"></span>|<span class="hljs-string">                                    </span>|<span class="hljs-string">      [copy write buffer to req]</span><br><span class="hljs-string"></span>|<span class="hljs-string">          [woken up]                </span>|<span class="hljs-string">      [wake up req-&gt;waitq]</span><br><span class="hljs-string"></span>|<span class="hljs-string">                                    </span>|<span class="hljs-string">    &lt;fuse_dev_write()</span><br><span class="hljs-string"></span>|<span class="hljs-string">                                    </span>|<span class="hljs-string">  &lt;sys_write()</span><br><span class="hljs-string"></span>|<span class="hljs-string">        &lt;request_wait_answer()      </span>|<br>|<span class="hljs-string">      &lt;request_send()               </span>|<br>|<span class="hljs-string">      [add request to               </span>|<br>|<span class="hljs-string">       fc-&gt;unused_list]             </span>|<br>|<span class="hljs-string">    &lt;fuse_unlink()                  </span>|<br>|<span class="hljs-string">  &lt;sys_unlink()                     </span>|<br></code></pre></td></tr></table></figure>
<ol type="1">
<li>用户程序发起文件系统操作 <code>rm /mnt/fuse/file</code></li>
<li>FUSE deamon 读 <code>/dev/fuse</code>，但此时 request
队列为空，因此触发 <code>request_wait()</code>，进入睡眠</li>
<li>用户程序触发系统调用 <code>sys_unlink()</code>，内核路由到 FUSE
操作函数，由将操作对应 request 加入 pending 队列，并唤醒 FUSE
deamon</li>
<li>FUSE deamon 被唤醒后，将 requset 从 pending 队列移除，并将其加入
processing 队列</li>
<li>FUSE deamon 返回用户空间后，根据读到的 request
进行相应自定义操作</li>
<li>FUSE deamon 执行完操作后，向 <code>/dev/fuse</code> 写 reply，将对应
request 从 processing 队列移除，并唤醒等待的用户程序</li>
<li>用户程序从内核系统调用返回，完成操作</li>
</ol>
<h2 id="instrumentation">Instrumentation</h2>
<p>为了研究 FUSE 的性能表现，研究人员<em>利用底层 API</em>
实现了一个栈（堆叠式）文件系统 <em>Stackfs</em>，直接建立在 ext4
文件系统之上，这样做的原因：</p>
<ul>
<li>大部分基于 FUSE 的文件系统都是堆叠式的</li>
<li>减少 FUSE deamon 的复杂度，这样能够尽可能还原 FUSE driver 和 FUSE
library 性能表现</li>
</ul>
<p>测试记录了在请求处理各个阶段（包括内核和用户态）花费的时间，为此，引入一个
43x32 的二维数组，行表示 43 种不同的 request，列表示以 2
为底的对数坐标时间。</p>
<p><strong>策略</strong>：在内核空间实现 3 个数组，分别用于监视
background、pending 和 processing 队列；在用户空间实现 1
个数组，用于监视 FUSE deamon 处理一个 requset 的时间
<strong>机制</strong>：内核空间利用了
<code>fusectl</code>，用户空间利用了 <code>SIGUSR1</code></p>
<h2 id="methodology">Methodology</h2>
<p>FUSE 配置、负载信息和实验平台，在此不一一列举。</p>
<blockquote>
<p>实验中 FUSE 氛围两种配置：基本配置 <em>StackfsBase</em> 和 优化配置
<em>StackfsOpt</em>，优化配置开启了 FUSE
的所有增强功能：（1）写回缓冲；（2）<code>max_write</code> 设置为
128KiB；（3）FUSE deamon
多线程；（4）splicing（零拷贝）对所有操作开启</p>
</blockquote>
<h2 id="evaluation">Evaluation</h2>
<p>测试结果汇总在表格中，其中的百分比表示相对于 ext4
性能变化，得到总体性的结果如下（原文翻译）：</p>
<blockquote>
<p>绿色区域：性能下降在 5% 以下 黄色区域：性能下降在 5-25% 之间
橙色区域：性能下降在 25-50% 之间 红色区域：性能下降在 50% 以上</p>
</blockquote>
<p><em>Observation 1.</em> 测试结果由于负载、外设和 FUSE
配置而导致的差异范围为 -83.1%（files-cr-1th [row #37]）到
+6.2%（web-server [row #45]）</p>
<p><em>Observation 2.</em> 对于大多数负载，FUSE
的优化配置能显著提升性能，如 web-server [row #45]，StackfsOpt 将性能提升
6.2%，而 StackfsBase 导致性能下降 50%。</p>
<p><em>Observation 3.</em>
尽管对于一些负载优化配置能提升性能，对于另一部分，优化配置反而导致性能下降。如
files-rd-1th [row #39]，StackfsOpt 导致性能下降 35%，下降幅度大于
StackfsBase 配置。</p>
<p><em>Observation 4.</em> 在 Stackfs 性能最佳的配置中（包括 StackfsOpt
和 StackfsBase），只有 2 个创建文件的负载（共 45
个工作负载）在红色区域：files-cr-1th [row #37] 和 files-cr-32th [row
#38]。</p>
<p><em>Observation 5.</em> Stackfs
的性能与底层设备有很大关系。如对于顺序读 [row #1-12]，Stackfs 在 SSD
上没有性能下降，而在 HDD 上有 26% 到 42% 的性能下降。而对于 mail-server
[row #44] 这个负载，情况恰恰相反。</p>
<p><em>Observation 6.</em>
对于所有的写负载（顺序的和随机的），至少有一个 Stackfs 配置能够在使用
HDD 和 SSD 的情况下都在绿色区域。</p>
<p><em>Observation 7.</em> 对于 HDD 和 SSD，顺序读 [rows #1-12]
的性能都在绿色区域；然而对于运行在 HDD 上的 seq-rd-32th-32f [rows
#5-8]，性能位于橙色区域。随机读的结果 [rows #13-20] 在所有 4
个区域均有分布。另外，对于 HDD 和 SSD，性能随着 I/O
规模的增加而上升。</p>
<p><em>Observation 8.</em> 总体上来说，相比于数据密集型负载 [rows
#1-36]，Stackfs 在元数据密集型和宏工作负载 [rows #37-45]
下明显性能更差，尤其是对 SSD 而言。</p>
<p><em>Observation 9.</em> 相较于 Ext4，Stackfs CPU 利用率更高，在
+0.13% 到 +31.2% 之间；同样的，每操作的 CPU 周期数也提升了 1.2<span
class="math inline">\(\times\)</span> 到 10 <span
class="math inline">\(\times\)</span> 不等。这一行为在 HDD 和 SSD
上表现一致。</p>
<p><em>Observation 10.</em> 对于大多数负载，StackfsOpt 的每操作的 CPU
周期数高于 StackfsBase。但对于负载 seq-wr-32th-32f [rows #25–28] 和
rnd-wr-1th-1f [rows #30–32]，StackfsOpt 的每操作的 CPU 周期数更低。</p>
<div id="footnotes">
<hr>
<div id="footnotelist">
<ol style="list-style:none; padding-left: 0;">
<li id="fn:1">
<span
style="display: inline-block; vertical-align: top; padding-right: 10px;">1.</span><span
style="display: inline-block; vertical-align: top;">https://www.kernel.org/doc/html/next/filesystems/fuse.html#kernel-userspace-interface</span><a href="#fnref:1" rev="footnote">
↩︎</a>
</li>
</ol>
</div>
</div>

            </div>
            <hr>
            <div>
              <div class="post-metas mb-3">
                
                  <div class="post-meta mr-3">
                    <i class="iconfont icon-category"></i>
                    
                      <a class="hover-with-bg" href="/categories/note/">note</a>
                    
                  </div>
                
                
                  <div class="post-meta">
                    <i class="iconfont icon-tags"></i>
                    
                      <a class="hover-with-bg" href="/tags/paper/">paper</a>
                    
                      <a class="hover-with-bg" href="/tags/fuse/">fuse</a>
                    
                  </div>
                
              </div>
              
                <p class="note note-warning">
                  
                    本博客所有文章除特别声明外，均采用 <a target="_blank" href="https://creativecommons.org/licenses/by-sa/4.0/deed.zh" rel="nofollow noopener noopener">CC BY-SA 4.0 协议</a> ，转载请注明出处！
                  
                </p>
              
              
                <div class="post-prevnext">
                  <article class="post-prev col-6">
                    
                    
                      <a href="/2024/03/11/Academic-English-Unit-1-Psychology/">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">Academic English: Unit 1 Psychology</span>
                        <span class="visible-mobile">上一篇</span>
                      </a>
                    
                  </article>
                  <article class="post-next col-6">
                    
                    
                      <a href="/2024/03/06/%E6%96%87%E7%8C%AE%E9%98%85%E8%AF%BB-bpftime-userspace-eBPF-Runtime-for-Uprobe-Syscall-and-Kernel-User-Interactions/">
                        <span class="hidden-mobile">文献阅读: bpftime: userspace eBPF Runtime for Uprobe, Syscall and Kernel-User Interactions</span>
                        <span class="visible-mobile">下一篇</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </article>
                </div>
              
            </div>

            
              <!-- Comments -->
              <article class="comments" id="comments" lazyload>
                
                  
                
                
  <div id="valine"></div>
  <script type="text/javascript">
    Fluid.utils.loadComments('#valine', function() {
      Fluid.utils.createScript('https://cdn.jsdelivr.net/npm/valine@1/dist/Valine.min.js', function() {
        var options = Object.assign(
          {"appId":"y7tlaLEOoW5C1xBYm8VBo64Q-gzGzoHsz","appKey":"F7gylUefEEtQk24FEbvgfnBi","path":"window.location.pathname","placeholder":"此处留言","avatar":"retro","meta":["nick","mail","link"],"requiredFields":[],"pageSize":10,"lang":"zh-CN","highlight":false,"recordIP":false,"serverURLs":"","emojiCDN":null,"emojiMaps":null,"enableQQ":false},
          {
            el: "#valine",
            path: window.location.pathname
          }
        )
        new Valine(options);
        Fluid.utils.waitElementVisible('#valine .vcontent', () => {
          Fluid.plugins.initFancyBox('#valine .vcontent img:not(.vemoji)');
        })
      });
    });
  </script>
  <noscript>Please enable JavaScript to view the comments</noscript>


              </article>
            
          </article>
        </div>
      </div>
    </div>
    
      <div class="d-none d-lg-block col-lg-2 toc-container" id="toc-ctn">
        <div id="toc">
  <p class="toc-header"><i class="iconfont icon-list"></i>&nbsp;目录</p>
  <div class="toc-body" id="toc-body"></div>
</div>

      </div>
    
  </div>
</div>

<!-- Custom -->


    

    
      <a id="scroll-top-button" aria-label="TOP" href="#" role="button">
        <i class="iconfont icon-arrowup" aria-hidden="true"></i>
      </a>
    

    
      <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">搜索</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v"
                 for="local-search-input">关键词</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>
    

    
  </main>

  <footer class="text-center mt-5 py-3">
  <div class="footer-content">
     <a href="https://hexo.io" target="_blank" rel="nofollow noopener"><span>Hexo</span></a> && <a href="https://github.com/fluid-dev/hexo-theme-fluid" target="_blank" rel="nofollow noopener"><span>Fluid</span></a> 
  </div>
  
  <div class="statistics">
    
    

    
      
        <!-- LeanCloud 统计PV -->
        <span id="leancloud-site-pv-container" style="display: none">
            总访问量 
            <span id="leancloud-site-pv"></span>
             次
          </span>
      
      
        <!-- LeanCloud 统计UV -->
        <span id="leancloud-site-uv-container" style="display: none">
            总访客数 
            <span id="leancloud-site-uv"></span>
             人
          </span>
      

    
  </div>


  

  
</footer>


  <!-- SCRIPTS -->
  
  <script  src="https://cdn.jsdelivr.net/npm/nprogress@0/nprogress.min.js" ></script>
  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/nprogress@0/nprogress.min.css" />

  <script>
    NProgress.configure({"showSpinner":false,"trickleSpeed":100})
    NProgress.start()
    window.addEventListener('load', function() {
      NProgress.done();
    })
  </script>


<script  src="https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js" ></script>
<script  src="https://cdn.jsdelivr.net/npm/bootstrap@4/dist/js/bootstrap.min.js" ></script>
<script  src="/js/events.js" ></script>
<script  src="/js/plugins.js" ></script>

<!-- Plugins -->


  <script  src="/js/local-search.js" ></script>



  
    <script  src="/js/img-lazyload.js" ></script>
  



  



  
    <script  src="https://cdn.jsdelivr.net/npm/tocbot@4/dist/tocbot.min.js" ></script>
  
  
    <script  src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3/dist/jquery.fancybox.min.js" ></script>
  
  
    <script  src="https://cdn.jsdelivr.net/npm/anchor-js@4/anchor.min.js" ></script>
  
  
    <script defer src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js" ></script>
  






  <script  src="https://cdn.jsdelivr.net/npm/typed.js@2/lib/typed.min.js" ></script>
  <script>
    (function (window, document) {
      var typing = Fluid.plugins.typing;
      var title = document.getElementById('subtitle').title;
      
        typing(title);
      
    })(window, document);
  </script>












  

  

  

  

  

  





<!-- 主题的启动项 保持在最底部 -->
<script  src="/js/boot.js" ></script>


<script type="text/x-mathjax-config">
    MathJax.Hub.Config({
        tex2jax: {
            inlineMath: [ ["$","$"], ["\\(","\\)"] ],
            skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code'],
            processEscapes: true
        }
    });
    MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax();
        for (var i = 0; i < all.length; ++i)
            all[i].SourceElement().parentNode.className += ' has-jax';
    });
</script>
<script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
</body>
</html>
